package org.ruanjj.maxarea;

public class Solution {
    //double points
    public int maxArea(int[] height) {
        int leftPoint = 0, rightPoint = height.length - 1;
        int res = 0;
        while(leftPoint < rightPoint){
            res = Math.max(res,Math.min(height[leftPoint],height[rightPoint]) * (rightPoint - leftPoint)) ;
            if(height[leftPoint] <= height[rightPoint]){
                leftPoint ++;
            }else{
                rightPoint--;
            }
        }
        return res;
    }
}
